﻿using System.Collections.Generic;

namespace xxpl1.HTTP.Runtime
{
    public class HandlerPipeline
    {
        private readonly List<IHttpRequestHandler> handlers = new List<IHttpRequestHandler>();

        public void Execute(HandlerContext context)
        {
            foreach (IHttpRequestHandler httpRequestHandler in handlers)
            {
                httpRequestHandler.Execute(context);
            }
        }

        public HandlerPipeline RegisterHanlder(IHttpRequestHandler handler)
        {
            handlers.Add(handler);

            return this;
        }
    }
}
